{% extends 'PortalMainBundle::layout.html.twig' %}

{% block stylesheets %}
  {{ parent() }}
{% endblock %}

{% block javascripts %}
  {{ parent() }}
<script>

    function sortFormSubmit() {
        $('#sortForm').submit()
    }
    </script>
{% endblock %}

{% block content %}
    {% include 'PortalMainBundle::Breadcrumbs/breadcrumbs.html.twig' with {'breadcrumbTitle':'Багш хайх', 'breadcrumbDetail':'Та өөрт тохирсон сонголтоо хийнэ үү.'} %}   
    <div class="span12">
        <div class="listContainer">
            <div style="height: 30px;">
                <div class="countContainer">Нийт {{countTutor}}</div>
                <div class="searchContainer">
                    <form action="" method="GET" id="sortForm" style="float: right;margin-bottom: 0">
                        <select name="orderBy" onchange="sortFormSubmit()">
                            <option value="1" {% if 1 == sortBy %} selected="selected" {% endif%}>Best match</option>
                            <option value="2" {% if 2 == sortBy %} selected="selected" {% endif%}>Lowest price</option>
                            <option value="3" {% if 3 == sortBy %} selected="selected" {% endif%}>Highest price</option>
                            <option value="4" {% if 4 == sortBy %} selected="selected" {% endif%}>Rating</option>
                            <option value="5" {% if 5 == sortBy %} selected="selected" {% endif%}>Distance</option>
                        </select>
                    </form>
                </div>
            </div>
    {% for key, tutor in tutorList %}

            <div class="tutorList">
                <div class="image"><img src="/images/portal/unknown.png" height="160" width="110"></div>    
                <div class="infoContainer">
                    <div><a href="{{path('tutor',{'id': tutor.tutorId})}}" style="text-decoration: none"><h4 class="std">{{ tutor.first_name|upper }}</h4></a></div>
                    <div><p style="margin-bottom: 0px;">{{tutor.description_short}}</p></div>
                    <div style="text-align: justify;">
                            {% if tutor.resume|length > 50 %}
                                {{tutor.resume[:200] }}... 
                            {% else %}
                                {{tutor.resume}} ...
                            {% endif %}
                        </div>

                    </div>
                    <div class="rateContainer">
                        <div style="text-align: right">
                            <h3 class="light" style="font-family:'Arial Narrow', Arial, sans-serif;font-size: 16px;font-weight: normal;margin-top: 0px;">{% if tutor.fee is not null %}{{tutor.fee}} / цагт {% else %} &nbsp; {% endif %}</h3>
                        </div>
                        <div style="text-align: right">
                            {% if tutor.address_district is not null %}
                        {{tutor.address_district}} дүүрэг
                        {% else %}
                                &nbsp;
                        {% endif%}
                            </div>
                            <div style="margin: 45px 0px 0px 0px;">
                                <a class="btn btn-success" style="width: 100%;padding: 10px 0px;" href="{{path('tutor',{'id': tutor.tutorId})}}">Дэлгэрэнгүй</a>
                            </div>
                        </div>
                    </div>
    {% else %}
    {% endfor %}
    {% render "PortalSearchBundle:Search:searchPager" with {'page' : page, 'per_page' : per_page, 'total' : countTutor, 'pageName' : 'page', 'delta' : 10} %}
                </div>
            {% include 'PortalSearchBundle::Search/rightModule.html.twig' %}
            </div>
{% endblock %}